home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
STRINGS
/
PACKAGE6
/
LEFT.DOC
< prev
next >
Wrap
Text File
|
1990-07-25
|
2KB
|
56 lines
------------------------------------------------------------------------------
LeftString
------------------------------------------------------------------------------
declaration: procedure LeftString ( OriginalString:
TypeString;
NumberOfChracters:
integer;
var ResultString:
TypeString);
purpose: Returns a portion of a string(original) in another
string(result).
preconditions: OriginalString was originally initiialized.
NumberOfCharacters has been a given a meaningfull value.
ResultString may be undefined.
postconditions: ResultString is filled with the desired number of characters
from the original string from left to right starting at far
left.
special cases: -if NumberOfCharacters = OriginalString._Length then
ResultString = OriginalString.
-if NumberOfCharacters > OriginalString._Length then
ResultString = OriginalString.
-if NumberOfCharacters <= 0 then ResultString._Length = 0 and
the ResultString._PackedArray is not changed.
example: var
OriginalString,
ResultString:
TypeString;
NumberOfCharacters:
integer;
LastKey:
TypeKey;
begin
.
.
.
ReadlnString (OriginalString, MaxStringLength, LastKey);
NumberOfCharacters := 5;
LeftString (OriginalString, NumberOfCharacters,
ResultString);
write(output,'The first five letters are ');
WriteString(ResultString);
writeln(output,'.')
.
.
.
end
------------------------------------------------------------------------------